#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

void Sort(int ary[], int len)
{

	for (int i = 1; i < len; i++)
	{
		int end = i - 1;
		int temp = ary[i];
		while (end >= 0)
		{
			if (ary[end] > temp)
			{
				ary[end + 1] = ary[end];
				end--;
			}
			else
			{
				break;
			}
		}

		ary[end + 1] = temp;
	}
	
}

void PrintAry(int ary[], int len)
{
	for (int i = 0; i < len; i++)
	{
		printf("%d ", ary[i]);
	}
	printf("\r\n");
}

int main()
{

	int ary[] = { 7,4,5,6,2,3 };
	PrintAry(ary, 6);
	Sort(ary, 6);
	PrintAry(ary, 6);

	return 0;
}
